/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.minhphuong.bll;

import com.minhphuong.dal.*;
import com.minhphuong.entities.*;
import com.sun.net.httpserver.HttpServer;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.ui.ModelMap;

/**
 *
 * @author QuocMinh
 */
public class SanPhamBLL {

    public static List<SanPham> getAllSanPham() {
        return SanPhamDAL.getAllSanPham();
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    public static void updateSanPham(SanPham sanpham)
    {
        SanPhamDAL.updateSanPham(sanpham);
    }

    public static List<SanPham> get6SanPhamNewest() {
        return SanPhamDAL.get6SanPhamNewest();
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static List<SanPham> get6SanPhamHot() {
        return SanPhamDAL.get6SanPhamHot();
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static SanPham getSanPhamByID(int id) {
        return SanPhamDAL.getSanPhamByID(id);
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static List<SanPham> getTopSanPham(int n) {
        return SanPhamDAL.getTopSanPham(n);
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static boolean insertSanPham(SanPham sanpham) {
        sanpham.setMaSp(HelperBLL.getNextID("SanPham", "maSp"));
        return SanPhamDAL.insertSanPham(sanpham);
        //return NguoiDungDAL.insertNguoiDung(nguoidung);
    }

    public static Hang getAllSanPhamByHang(String tenHang) {
        return SanPhamDAL.getAllSanPhamByHang(tenHang);
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static List<SanPham> getAllSanPhamByTimKiem(String search_category, String search_price, String search_productname) {
        return SanPhamDAL.getAllSanPhamByTimKiem(search_category, search_price, search_productname);
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static List<SanPham> getAllSanPhamByTimKiemLimit(String search_category, String search_price, String search_productname, int start, int display) {
        return SanPhamDAL.getAllSanPhamByTimKiemLimit(search_category, search_price, search_productname, start, display);
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static List<SanPham> getAllSanPhamGioHang(HttpSession session) {
        return SanPhamDAL.getAllSanPhamGioHang(session);
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static void deleteAllSanPhamGioHang(HttpSession session) {
        SanPhamDAL.deleteAllSanPhamGioHang(session);
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public static void deleteSanPhamGioHangByID(HttpSession session, int id) {
        SanPhamDAL.deleteSanPhamGioHangByID(session, id);
    }

    public static void updateGioHang(HttpSession session, HttpServletRequest request) {
        SanPhamDAL.updateGioHang(session, request);
    }

    public static void submitGioHangHoaDon(HttpSession session, HttpServletRequest request, ModelMap map) {
        SanPhamDAL.submitGioHangHoaDon(session, request, map);
    }
}
